<div style="height:550px;width: 100%" id="sidebar_left">
<div class="m_leftbar">
    <dl>
				<dt>
					<a  href="#">互动交流</a>
				</dt>
    </dl>
    <ul>
        <?php
        if($_SESSION['type']=='')
        {
            fs_showmsg('请先登录!','?');
        }
?>
        <li><a href="?do=message">发邮件</a></li>
        <li><a href="?do=inbox">已发邮件</a></li>
         <li><a href="?do=groupmail&c=already">班级邮件</a></li>
        <li><a href="?do=draft">草稿箱</a></li>
    </ul>
</div>
<!--<script type="text/javascript">
    CKEDITOR.replace( 'm_content',{ height : '100px', width:'600px',toolbar:'MyToolbar',fontSize_sizes:'16/16px' } );
</script>-->
<?PHP 
if($_SESSION['type']=='3')
{?>
<div class="m_rightbar">
<div class="m_title">编辑草稿箱</div>
            <div class="m_sendbox">
                <?php
                    $sql ="select m.object,m.m_id,m.m_to,m.content,b.realname from nettteach_message as m inner join nettteach_member as b on m.m_to=b.id  where  m.m_id=".$_GET['id'];
                    $query =$db->query($sql);
                    $mailinfo = $db->fetch_array($query);
                    ?>
                <form method="post" action="">
                    <table cellpadding="0" cellspacing="0" id="m_box">
                        <tr>
                            <td>收件老师:&nbsp;&nbsp;</td>
                            <td>
                               <?php echo $mailinfo['realname']?><input type="hidden" value="<?php echo $mailinfo['m_to']?>" name="teacher"/>
                               <input type="hidden" value="<?php echo $mailinfo['m_id']?>" name="mid"/>
                            </td>
                        </tr>
                        <tr>
                            <td>主题:</td>
                            <td><input type="text" name="m_title" id="m_title" style="width:300px;height: 23px;" value="<?php echo $mailinfo['object']?>" /></td>
                        </tr>
                        <tr>
                            <td >内容:</td>
                            <td><textarea  id="m_content" name="m_content" rows="10" cols="45"><?php echo $mailinfo['content']?></textarea></td>
                            </td>
                        </tr>
                        <tr>
                            <td><input type="submit" name="sub" id="sub" value="发送" /></td>
                            <td><input type="submit" name="save" id="save" value="保存为草稿"/></td>
                        </tr>
                    </table>
                </form>
            </div>
</div>
</div>
<?php
}?>
<?php
if($_POST['sub']||$_POST['save'])
{
    if($_SESSION['sid']=='')
    {
        fs_showmsg('请登录后再发送!');
    }
    $title = $_POST['m_title'];
    $content = $_POST['m_content'];
    if($title==''||$content=='')
    {
        fs_showmsg('主题或内容不能为空');
    }
    $to =$_POST['teacher'];
    if($_POST['sub'])
    {
        $sql = "update nettteach_message set object='".$title."',content='".$content."',sendtime=".time().",is_save=0 where m_id=".$_POST['mid'];
        $query = $db->query($sql);
        if($query)
        {
            fs_showmsg('发送成功!');
        } 
    }
    else
    {
        $sql = "update nettteach_message set object='".$title."',content='".$content."',sendtime=".time()." where m_id=".$_POST['mid'];
        $query = $db->query($sql);
        if($query)
        {
            fs_showmsg('保存成功,可以到草稿箱查看.');
        } 
        
    }
    
}
?>